package com.jw.system.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jw.response.Result;
import com.jw.system.entity.GoodsCategory;
import com.jw.system.entity.vo.GoodsCategoryVO;
import com.jw.system.entity.vo.UserVO;
import com.jw.system.service.GoodsCategoryService;
import com.jw.system.service.MenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 商品分类表 前端控制器
 * </p>
 *
 * @author jw
 * @since 2021-04-20
 */
@RestController
@RequestMapping("/cat")
@Api(value = "商品分类模块", tags = "商品分类接口")
public class GoodsCategoryController {

    @Autowired
    private GoodsCategoryService goodsCategoryService;

    @ApiOperation(value = "商品分类列表", notes = "分页查询商品分类列表")
    @GetMapping("/getCatList")
    public Result getCatList(@RequestParam(value = "pageNum", required = false) Integer current,
                              @RequestParam(value = "pageSize", required = false) Integer size){
        Page<GoodsCategoryVO> catList = goodsCategoryService.getCatList(current, size);
        return Result.ok().data("cat",catList.getRecords()).data("total",catList.getTotal());
    }

}

